import java.io.*;
import java.net.*;
public class TCPBind
{
	public static void main(String args[]) throws IOException{
		ServerSocket server = new ServerSocket(4567);
		while(true){
			Socket client = server.accept();
			System.out.println("************Connection opened!************");
			BufferedReader br = new BufferedReader(new InputStreamReader(client.getInputStream()));
			String msg;
			while((msg = br.readLine())!=null){
				System.out.println(msg);
			}
			System.out.println("************Connection closed!************");
		}
	}
}